<template>
    <div class="ipt">
        <input-title :title="title" :placeholder="placeholder" :required="required"></input-title>
        <el-input :data-font="$i18n.locale" type="textarea" v-model="value" :maxlength="max" :placeholder="placeholder"
            show-word-limit :rows="rows" :style="{ '--height': height }" :disabled="disabled"></el-input>
    </div>
</template>

<script>
import inputTitle from '../input-title';
export default {
    props: {
        title: {
            type: String,
            defaule: ''
        },
        required: {
            type: Boolean,
            default: false
        },
        placeholder: {
            type: String,
            default: ''
        },
        max: {
            type: [Number, String],
            default: ''
        },
        rows: {
            type: Number,
            defaule: ''
        },
        height: {
            type: String,
            default: ""
        },
        disabled: {
            type: Boolean,
            default: false
        },
        history: {
            type: String,
            default: ''
        }
    },
    components: {
        inputTitle
    },
    data() {
        return {
            value: this.history
        }
    },

    watch: {
        value: {
            deep: true,
            handler(newVal, oldVal) {
                this.$emit('message', newVal);
            },
            immediate: true
        },
        history: {
            deep: true,
            handler(newVal, oldVal) {
                this.value = newVal;
                this.$emit('message', newVal);
            },
            immediate: true
        }
    }
}
</script>

<style lang="less" scoped>
.ipt {
    width: 100%;
    flex-shrink: 1;
    display: flex;
    flex-direction: column;
}


.el-textarea :deep(.el-textarea__inner) {
    resize: none;
    box-shadow: none;
    background: none;
    font-weight: normal;
    color: #68656C;
    background: linear-gradient(315deg, rgba(250, 251, 255, 0.25) 0%, rgba(252, 248, 255, 0.25) 100%);
    border: 0.03rem solid #C5C5CA;
    border-radius: 0;
    height: var(--height);
}

.el-textarea :deep(.el-textarea__inner[data-font="zh"]) {
    font-size: 0.53rem;
    font-family: 'IdeaFonts-DianHei-DEJ', 'IdeaFonts-DianHei';
    line-height: 0.85rem;
}

.el-textarea :deep(.el-textarea__inner[data-font="en"]) {
    font-size: 0.48rem;
    font-family: 'Helvetica';
    line-height: 0.75rem;
}

.el-textarea :deep(.el-textarea__inner[data-font='zh']::placeholder) {
    font-size: 0.53rem;
    font-family: 'IdeaFonts-DianHei-DEJ', 'IdeaFonts-DianHei';
    font-weight: normal;
    color: #C5C5CA;
    line-height: 0.85rem;
}

.el-textarea :deep(.el-textarea__inner[data-font='en']::placeholder) {
    font-size: 0.48rem;
    font-family: 'Helvetica';
    color: #C5C5CA;
    line-height: 0.75rem;
}

.el-textarea :deep(.el-input__count) {
    font-size: 0.43rem;
    font-family: 'IdeaFonts-DianHei-DEJ', 'IdeaFonts-DianHei';
    font-weight: normal;
    color: #C5C5CA;
    line-height: 0.85rem;
    background: none;
    right: 0.08rem;
    bottom: 0.03rem;
}
</style>